/*
 * @Author: webcc
 * @Date: 2022-10-22 13:21:18
 * @LastEditTime: 2022-10-24 09:52:49
 * @email: webcc.coder@qq.com
 */
import { Router, Link, Route, Switch, Redirect } from 'react-router-dom'
import Login from 'pages/Login'
import Layout from 'pages/Layout'
import NotFound from 'components/NotFound'
import history from 'utils/history'
import AuthRoute from 'components/AuthRoute';
function App() {
  //自己创建history
  // HashRouter = <Router history={ createHashHistory()}></Router>
  // BrowserRouter = <Router history={ createBrowserHistory()}></Router>

  return (
    <Router history={history}>
      {/* <Link to="/home">首页</Link>
      <Link to="/login">登录</Link> */}

      <Switch>
        {/* 有from属性时必须放在Switch里 */}
        <Redirect exact from="/" to="/home"></Redirect>
        <AuthRoute path="/home" component={Layout}></AuthRoute>
        <Route path="/login" component={Login}></Route>
        <Route component={NotFound}></Route>
      </Switch>
    </Router>
  );
}

export default App;
